<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>合并多个对象</title>
</head>
<body>
<!--
  语法: object mergeObject(...objs)
  功能: 合并多个对象, 返回一个合并后对象(不改变原对象)
  合并前:
      { a: [{ x: 2 }, { y: 4 }], b: 1}
      { a: { z: 3}, b: [2, 3], c: 'foo'}
  合并后:
      { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }
-->
<script src="../lib/JustMicrobundle.umd.js"></script>
<script>
    const object = {
        a: [{x: 2}, {y: 4}],
        b: 1
    }
    const other = {
        a: {z: 3},
        b: [2, 3],
        c: 'foo'
    }
    console.log(JustMicrobundle.mergeObject(object, other))
    // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }
</script>
</body>
</html>
